package com.cincc.cinccimdemo.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;

import cn.jzvd.JzvdStd;

public class MyVideoPlayer extends JzvdStd {

    public MyVideoPlayer(Context context, AttributeSet attrs) {
        super(context, attrs);
        //设置全屏按钮隐藏
        this.fullscreenButton.setVisibility(View.GONE);
        //设置总时间view的rightMargin
        LinearLayout.LayoutParams startLayoutParams = (LinearLayout.LayoutParams) this.currentTimeTextView.getLayoutParams();
        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.totalTimeTextView.getLayoutParams();
        layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin, startLayoutParams.leftMargin, layoutParams.bottomMargin);
        this.totalTimeTextView.setLayoutParams(layoutParams);
    }

    @Override
    public void onCompletion() {
        super.onCompletion();
        onCompleteListener.onCompletion();
    }

    private OnCompleteListener onCompleteListener;

    public interface OnCompleteListener {
        void onCompletion();
    }

    public void setOnCompleteListener(OnCompleteListener onCompleteListener) {
        this.onCompleteListener = onCompleteListener;
    }
}
